<script type="text/javascript">
    var projectTabSelected = '<?php echo $_SESSION['projectTab'];?>';
    $(document).ready(function () {
        $("#projectTab1").click(function () {
            $.ajax({
                url: AJAX_PROCESS_URL+'setTabProject',
                type: 'POST',
                data: "tab=1",
                error: function(){
                    alert('Connection error!');
                },
                success: function(){
                    window.location = '<?php echo get_link("projects");?>';
                }
            });
        });

        $("#projectTab2").click(function () {
            $.ajax({
                url: AJAX_PROCESS_URL+'setTabProject',
                type: 'POST',
                data: "tab=2",
                error: function(){
                    alert('Connection error!');
                },
                success: function(){
                    window.location = '<?php echo get_link("projects");?>';
                }
            });
        });
        $("#projectTab3").click(function () {
            $.ajax({
                url: AJAX_PROCESS_URL+'setTabProject',
                type: 'POST',
                data: "tab=3",
                error: function(){
                    alert('Connection error!');
                },
                success: function(){
                    window.location = '<?php echo get_link("projects");?>';
                }
            });
        });

    });
</script>

<div class="main_right">


    <div class="newsBDS">
        <div class="newsBDS_left" style="margin-bottom:10px;">
            <div class="boxslide">
                <div id="slide_content">
                    <div id="slider1" class="sliderwrapper">
                        <?php
                        $rsNews = getNewsHome();
                        while($rs=$db->fetch_array($rsNews)) {
                            ?>
                        <div class="contentdiv">
                            <div class="infoslide">
                                <div style="width: 400px;"><a href="<?php echo get_link("news","detail",$rs['title_link']); ?>"><b><?php echo limitWord($rs['title'],10);?></b></a><div class="created_date">Ngày đăng:&nbsp;<?php echo get_my_date($rs['create_date']);?></div></div>
                                <div style="margin-top: 10px"><div style="width:100px;float: left;border:1px solid #3875d7;padding: 1px;margin-right: 10px" class="thumbs"><img width="100px" height="100px" src="<?php echo get_news_thumb($rs['image'], '91-71')?>"  /></div><div style="width: 270px;float: left"><?php echo limitWord($rs['description'],70);?></div></div>
                            </div>

                        </div>
                        <?php
                    }
                    ?>

                    </div>
                    <div class="btlatest">

                        <div id="paginate-slider1" class="pagination"></div>
                        <script type="text/javascript">

                            featuredcontentslider.init({
                                id: "slider1", //id of main slider DIV
                                contentsource: ["inline", ""], //Valid values: ["inline", ""] or ["ajax", "path_to_file"]
                                toc: "#increment", //Valid values: "#increment", "markup", ["label1", "label2", etc]
                                nextprev: ["&laquo;", "&raquo;"], //labels for "prev" and "next" links. Set to "" to hide.
                                enablefade: [true, 0.2], //[true/false, fadedegree]
                                autorotate: [true, 3000], //[true/false, pausetime]
                                onChange: function(previndex, curindex){ //event handler fired whenever script changes slide
                                    //previndex holds index of last slide viewed b4 current (1=1st slide, 2nd=2nd etc)
                                    //curindex holds index of currently shown slide (1=1st slide, 2nd=2nd etc)
                                }
                            })

                        </script>
                    </div>
                    <div class="newcate">
                        <ul>
                            <?php $arrcatnewHome=getCatNewsToArray();
                            for ($k=0;$k<count($arrcatnewHome);$k++) {
                                ?>
                            <li ><a href="<?php echo get_link("news","cat",$arrcatnewHome[$k]['cat_link']);?>" title="<?echo $arrcatnewHome[$k]['cat_title'];?>"><?echo $arrcatnewHome[$k]['cat_title'];?></a>&nbsp;<span style="color: #000">|</span></li>
                            <?php
                        }

                        ?>
                        </ul>
                        ...
                    </div>
                </div>

            </div>

        </div>

        <div class="newsright">
            <div class="title_right"><h2>[Sự kiện bất động sản]</h2></div>
            <div class="content_TV" style="height:187px;">
                <ul>
                    <?php
                    $rsNews = getNewsReal();
                    $i=0;
                    while($rs=$db->fetch_array($rsNews)) {

                        if($i==0) {
                            ?>
                    <li style="height:124px;"><a href="<?php echo get_link("news","detail",$rs['title_link']); ?>"><b><?php echo limitWord($rs['title'],10);?></b></a><div class="created_date">Ngày đăng:&nbsp;<?php echo get_my_date($rs['create_date']);?></div><br><img class="thum_tv" src="<?php echo get_news_thumb($rs['image'], '91-71')?>" width="91" height="71" /><div style="margin-right: 10px"><?php echo limitWord($rs['description'],30);?></div></li>
                    <?php
                }
                else {
                    ?>
                    <li><img src="/images/point2.gif" /><a href="<?php echo get_link("news","detail",$rs['title_link']); ?>"><?php echo limitWord($rs['title'],18);?></a></li>
                    <?php
                }
                $i++;
            }
            ?>
                </ul>

            </div>
        </div>
    </div>
    <div style="float:left;width: 100%">
    <div class="folder" >
        <div class="folder-title-new00" >
            <div class="square00"></div>
            <div style="margin-top: 7px;float: left"><a>[SẢN PHẨM ĐANG GIAO DỊCH]</a></div>
        </div>
        <div class="folder-body00" style="height:202px">
            <div id="demo" style="overflow:hidden;position:relative; width: 725px; height: auto">
                <table border="0" align="left" cellpadding=0 bgcolor="#ffffff" cellspace="0">
                    <tr>
                        <td id="demo1" valign="top" width="1335">
                            <table border="0" align="left" cellpadding="0" cellspacing="0" style="height:158px">
                                <tr valign="top" bgcolor="#FFFFFF">
                                    <?php
                                    $rsPropertySellLeft = getPropertySellLeft();
                                    while($rs=$db->fetch_array($rsPropertySellLeft)) {
                                        ?>
                                    <td align=middle>
                                        <table cellspacing=0 cellpadding=0 border=0 >
                                            <tr>
                                                <td align="center" style="padding: 0px 5px 0px 5px;">
                                                    <a href="<?php echo get_link("property","detail",$rs['title_link']); ?>" >
                                                        <img class="thum_tv" style="width:120px;height: 90px"  src="<?php echo get_property_thumb($rs['thumb'],'120-90');?>" alt="" title="" />
                                                    </a>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="left" style="padding: 5px 5px 0px 5px;">
                                                    <a href="<?php echo get_link("property","detail",$rs['title_link']); ?>" style="color: #000000;">
                                                        <b><?php echo limitWord($rs['title'],4); ?></b>
                                                    </a>
                                                </td>
                                            </tr>
                                            <tr>
                                                <td align="left" style="padding: 0px 5px 0px 5px;">
                                                    [Diện tích]: <?php echo showData(format_thousand($rs["area_build"]))." m2" ;?><br />
                                                    <span style="color: Red">[Giá]: <?php echo showData(get_price_string($rs["price"]*$rs["area_build"])) ;?></span>
                                                </td>
                                            </tr>
                                        </table>
                                    </td>
                                    <?php
                                }
                                ?>
                                </tr>
                            </table>
                        </td>
                        <td id="demo2" valign="top" width="19">&nbsp;</td>
                    </tr>
                </table>

            </div>
            <?php if($db->num_rows($rsPropertySellLeft)>5){?>
            <script type="text/javascript" language="javascript">

                var td_demo = document.getElementById("demo");
                var td_demo1 = document.getElementById("demo1");
                var td_demo2 = document.getElementById("demo2");
                td_demo2.innerHTML = td_demo1.innerHTML;
                var demo_left = 0;
                var demo_width = td_demo1.offsetWidth;
                function Marquee()
                {
                    demo_left++;
                    if (demo_left>=demo_width)
                    {
                        demo_left-=demo_width;
                    }
                    td_demo.scrollLeft = demo_left;
                    //setTimeout("Marquee()", speed);
                }
                var speed = 50;
                var MyMar = setInterval ("Marquee()", speed);
                td_demo.onmouseover = function()
                {
                    clearInterval (MyMar) ;
                }
                td_demo.onmouseout = function()
                {
                    MyMar = setInterval ("Marquee()", speed);
                }
            </script>
            <?php } ?>
            <div class="cate_home">
                <ul>
                    <?php
                    $arrCat = listAllPropertyCategoryLeft(1);

                    for($i=0;$i<count($arrCat);$i++) {
                        ?>
                    <li ><a href="<?php echo get_link("property","cat",$arrCat[$i]['cat_link']);?>" title="<?echo $arrCat[$i]['cat_title'];?>"><?echo $arrCat[$i]['cat_title'];?></a>&nbsp;<span style="color: #000">|</span></li>
                    <?php
                }

                ?>
                </ul>
                ...
            </div>
            <div style="float:right;width: 10%;margin-top: -7px!important;margin-top: 10px;margin-right: 27px!important;margin-right: -5px;cursor: pointer"><a href="<?php echo get_link("property");?>"> <img style="border-width: 0px;" src="<?php echo SITE_IMAGES_URL; ?>/bg_xemthem.gif" ></a></div>
        </div>
        <div class="folder-bottom00">
            <div class="square-bottom00"></div>
        </div>
    </div>
    <div class="folder" >
        <div class="folder-title-new00" >
            <div class="square00" ></div>
            <?php
            $rsProjectsCat = getProjectCatHome();
            $i=0;
            while($rsCat=$db->fetch_array($rsProjectsCat)) {
                if($i==$db->num_rows($rsProjectsCat)-1) {
                    ?>
            <div class="project_home_cate_end"><?php echo limitWord($rsCat['cat_title'],15);?></div>
            <?php
        }
        else {
            ?>
            <div class="project_home_cate"><?php echo limitWord($rsCat['cat_title'],15);?></div>

                    <?php
                }
                $i++;
            }
            ?>
        </div>
        <div class="folder-body00" style="padding-top:5px;" >
            <div style="height:260px;">
                <?php
                $rsProjectsCat = getProjectCatHome();
                $i=0;
                while($rsCat=$db->fetch_array($rsProjectsCat)) {
                    $i++;
                    ?>
                <div class="project_home">
                    <?php
                    $rsProjects = getProjectByCatIdHome($rsCat['cat_id']);
                    while($rsPro=$db->fetch_array($rsProjects)) {
                        ?>
                    <div ><a href="<?php echo get_link("projects","detail",$rsPro['title_link']); ?>" ><img  style="border:1px #cccccc solid;padding:1px;width:150px;height:120px" src="<?php echo get_project_thumb($rsPro['thumb'],'150-120');?>" /></a></div>
                    <div class="title_project_home"><a href="<?php echo get_link("projects","detail",$rsPro['title_link']); ?>"><?php echo limitWord($rsPro['title'],5);?></a></div><div style="margin-left: 10px;text-align: left;height: 75px"><?php echo limitWord($rsPro['description'],35);?></div>

                            <?php }?>
                    <div style="margin: 10px 5px 0 0;text-align: right" class="title_project_home">
                        <a id="projectTab<?php echo $i;?>" href="javascript: void(0);">[Xem thêm]</a><img src="images/arrow3.gif" />

                    </div>
                </div>

                    <?php

                }
                ?>
            </div>
        </div>
        <div class="folder-bottom00">
            <div class="square-bottom00"></div>
        </div>
    </div>
    <script type="text/javascript">
        $(document).ready(function () {
            $("#tabHomeSell").click(function () {
                $("#tabHomeSell").addClass('current');
                $("#tabHomeRent").removeClass('current');
                $('#tabHomeRentContent').hide();
                $('#tabHomeSellContent').show('fast');
            });
            $("#tabHomeRent").click(function () {
                $("#tabHomeSell").removeClass('current');
                $("#tabHomeRent").addClass('current');
                $('#tabHomeSellContent').hide();
                $('#tabHomeRentContent').show('fast');
            });
        });

    </script>
    <table border="0px" cellpadding="0px" cellspacing="0px">
        <tr>
            <td style="width:425px;" valign="top">
                <div class="folder" >
                    <div class="folder-title-new00" >
                        <div class="square00"></div>
                        <div style="margin-top: 7px;float: left"><a>[HỎI ĐÁP BẤT ĐỘNG SẢN]</a></div>
                    </div>
                    <div class="folder-body00" style="height:315px">

                        <div class="faq_home" >
                            <ul>
                                <?php
                                $rs_faq = getFAQHome();
                                while($faq=$db->fetch_array($rs_faq)) {

                                    echo "<li >";
                                    echo "<a href='".get_link('faq','detail',$faq["title_link"])."' title='".htmlentities_utf8($faq["title"])."' ><b>".limitWord($faq["title"],25)."</b></a><br />";
                                    echo limitWord(strip_tags($faq["content"]),28);

                                    echo "</li>";

                                }

                                echo "<li style='border:none;'><h2><a href='".get_link('faq','detail',$faq["title_link"])."' title='".htmlentities_utf8($faq["title"])."' >[Xem thêm]</a><img src='images/arrow3.gif' /></h2></li>";
                                ?>
                            </ul>

                        </div>
                    </div>
                    <div class="folder-bottom00">
                        <div class="square-bottom00"></div>
                    </div>
            </div></td>
            <td valign="top"><div style="margin-left:5px;float: right; width:330px;">
            <div class="folder" >
                    <div class="folder-title-new00" >
                        <div class="square00"></div>
                        <div style="margin-top: 7px;float: left"><a>Video</a></div>
                    </div>
                    <div class="folder-body00" style="height:315px">
                            
    <!-- player container-->
			<?php
                $rsVideo = getNewestVideo();
            ?>
            <font style="color: #0086C5;font-weight: bold;" ><?php echo $rsVideo["title"]; ?></font>
    
            <div id="player" style="margin-bottom: 5px;margin-top: 5px" ><?php echo $rsVideo["embed_code"]; ?></div>
<a href='<?php echo get_link('video');?>' ><img src='images/view_more.gif' /></a>
                      
                    </div>
                    <div class="folder-bottom00">
                        <div class="square-bottom00"></div>
                    </div>
                    
            </div>
                </div>
                </td>
        </tr>

    </table>
</div>

</div>
<div style="width:100%;height:10px"></div>